import {GET, POST} from "@/api/network";

export module Api {
    export module Capital {

        /*
        type Item struct {
		Amount     uint64                `json:"amount"`
		Account    string                `json:"account"`
		CreateTime time.Time             `json:"create_time"`
		Status     pb.ClubWithdrawStatus `json:"status"`
		WithdrawID string                `json:"withdraw_id"`
		ClubID     string                `json:"club_id"`
		Uid        string                `json:"uid"`
		Name       string                `json:"name"`
		RealName   string                `json:"real_name"`
		ClubName   string                `json:"club_name"`
	}

	type Ack struct {
		Index int32   `json:"index"`
		Items []*Item `json:"items"`
		Count int32   `json:"count"`
	}

	type Query struct {
		Index int32 `from:"index"`
	}
         */
        
        export interface GetWithdrawApplyListResponse_Item {
            amount:number
            account:number
            create_time:string
            status:number
            withdraw_id:string
            club_id:string
            uid:string
            name:string
            real_name:string
            club_name:string
            fee:number
            withdraw_fee:number
            withdraw_amount:number
            trade_no:string
        }

        export interface GetWithdrawApplyListResponse {
            items:Array<GetWithdrawApplyListResponse_Item>
            index:number
            count:number
        }

        export interface GetWithdrawApplyListRequest {
            index:number
            all:boolean
        }

        export function GetWithdrawApplyList(ask : GetWithdrawApplyListRequest) : Promise<GetWithdrawApplyListResponse> {
            return GET('/capital/withdraw/list', {
                query:{
                    index:ask.index,
                    all:ask.all,
                }
            })
        }


        export interface GetWithdrawApplyRequest {
            id:string
        }

        export interface GetWithdrawApplyResponse {
            amount:number
            account:number
            create_time:string
            status:number
            withdraw_id:string
            club_id:string
            uid:string
            name:string
            real_name:string
            club_name:string
            fee:number
            withdraw_fee:number
            withdraw_amount:number
            trade_no:string
        }

        export function GetWithdrawApply(ask:GetWithdrawApplyRequest) : Promise<GetWithdrawApplyResponse> {

            return GET(
                `/capital/withdraw/view/${ask.id}`
            )
        }

        export interface SetWithdrawApplyRequest {
            withdraw_id:string
            amount:number
            fee:number,
            trade_no:string
            allow:boolean
        }

        export interface SetWithdrawApplyResponse {

        }

        export function SetWithdrawApply(ask:SetWithdrawApplyRequest) : Promise<SetWithdrawApplyResponse> {
            return POST(
                `/capital/withdraw/set`,
                ask,
            )
        }

    }
}

export default Api.Capital